package com.driving.single.common.exception;

import org.apache.http.HttpStatus;

/**
 * 全局业务异常
 *
 * @author xsfno1
 * @version v1.0.0
 * @date 2020/2/20 17:27
 * @see com.driving.single.common.exception
 **/
public class DrivingException extends RuntimeException {
    private static final long serialVersionUID = 3034121940056795549L;

    private Integer status;
    private String message;

    /**
     * 默认状态码 400
     */
    private static final Integer BAD_REQUEST = HttpStatus.SC_BAD_REQUEST;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public DrivingException() {
    }

    public DrivingException(String message) {
        this.status = BAD_REQUEST;
        this.message = message;
    }

    public DrivingException(Integer status, String message) {
        this.status = status;
        this.message = message;
    }
}
